#include <iostream>
#include <string>
#include <vector>
#include <functional>

// 声明每个标准的演示函数（根据编译选项条件性声明）
#ifdef BUILD_CPP14
namespace cpp14 {
void demonstrate_features();
}
#endif

#ifdef BUILD_CPP17
namespace cpp17 {
void demonstrate_features();
}
#endif

#ifdef BUILD_CPP20
namespace cpp20 {
void demonstrate_features();
}
#endif

#ifdef BUILD_CPP23
namespace cpp23 {
void demonstrate_features();
}
#endif

int main() {
    std::cout << "C++标准特性演示程序\n";
    std::cout << "==================\n\n";

    std::vector<std::pair<std::string, std::function<void()>>> demos;

#ifdef BUILD_CPP14
    demos.push_back({"C++14特性", cpp14::demonstrate_features});
#endif

#ifdef BUILD_CPP17
    demos.push_back({"C++17特性", cpp17::demonstrate_features});
#endif

#ifdef BUILD_CPP20
    demos.push_back({"C++20特性", cpp20::demonstrate_features});
#endif

#ifdef BUILD_CPP23
    demos.push_back({"C++23特性", cpp23::demonstrate_features});
#endif

    if (demos.empty()) {
        std::cout << "警告：没有启用任何C++标准特性！\n";
        std::cout << "请使用CMake选项启用至少一个标准特性，例如：\n";
        std::cout << "  cmake -DBUILD_CPP14=ON ..\n";
        return 1;
    }

    for (const auto& [name, demo] : demos) {
        std::cout << "\n" << name << "\n";
        std::cout << std::string(name.length(), '-') << "\n";
        demo();
        std::cout << "\n";
    }

    return 0;
} 